package com.tadpole.music.holder.question;

import android.view.View;
import android.widget.TextView;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.question.QuestionClassBean;
import com.tadpole.music.holder.base.BaseViewHolder;
import com.tadpole.music.utils.NoDoubleClickListener;

import java.util.List;

/**
 * Created By 孙岩
 * on 2020/9/11
 */
public class SimulationPracticeViewHolder extends BaseViewHolder {
    private View itemView;
    private List<QuestionClassBean.DataBean> list;
    private BaseAdapter.OnItemClickListener onItemClickListener;
    private TextView tvName;

    public SimulationPracticeViewHolder(View itemView,BaseAdapter.OnItemClickListener onItemClickListener,List<QuestionClassBean.DataBean> list) {
        super(itemView);
        this.itemView = itemView;
        this.onItemClickListener = onItemClickListener;
        this.list = list;
    }

    @Override
    public void init(final int position) {
        tvName = itemView.findViewById(R.id.tvName);
        tvName.setText(list.get(position).getName());

        itemView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                onItemClickListener.onItemClick(itemView,position);
            }
        });
    }
}
